﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ListOrganization.ascx.cs"
    Inherits="Pantry.Web.Users.Controls.ListOrganization" %>
<%@ Register TagPrefix="asp" Assembly="CollectionPager" Namespace="SiteUtils" %>
<asp:UpdatePanel runat="server" ID="UpdatePanelOrganization">
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="LinkButtonOrganizationName" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="LinkButtonDescription" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="LinkButtonRole" EventName="Click" />
    </Triggers>
    <ContentTemplate>
        <div class="widget_contents noPadding">

            <div class="dtTables">
                <table class="tables noObOLine">
                    <thead>
                        <tr>
                            <th class="sorting">
                                <asp:LinkButton runat="server" ID="LinkButtonOrganizationName" Text="Organization Name" OnClick="LinkButtonOrganizationNameClick"/>
                            </th>
                            <th class="sorting">
                                <asp:LinkButton runat="server" ID="LinkButtonDescription" Text="Description" OnClick="LinkButtonDescriptionClick"/>
                            </th>
                            <th class="sorting">
                                <asp:LinkButton runat="server" ID="LinkButtonRole" Text="Role" OnClick="LinkButtonListRoleClick" />
                            </th>
                            <th class="sorting">
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <asp:Repeater runat="server" ID="RepeaterOrganization" EnableViewState="True">
                            <ItemTemplate>
                                <tr>
                                    <td>
                                        <%#Eval("OrganizationName") %>
                                    </td>
                                    <td>
                                        <%#Eval("ShortDescription") %>
                                    </td>
                                    <td>
                                        <%#Eval("ListRole")%>
                                    </td>
                                    <td>
                                        <span style="color: green">
                                            <asp:LinkButton runat="server" ID="LinkButtonEditRole" ForeColor="green" Text="Edit"
                                                CommandName="click" CommandArgument='<%#Eval("OrganizationId") + "$" + Eval("ListRole") %>'
                                                OnClick="EditRolePopupClick" />
                                        </span>
                                    </td>
                                </tr>
                            </ItemTemplate>
                        </asp:Repeater>
                    </tbody>
                </table>
            </div>
        </div>
        <div class="dtBottom">
            <div class="dtPagination">
                <asp:CollectionPager runat="server" ID="CollectionPager1" BackText="Back" FirstText="First"
                    ShowLabel="True" ShowFirstLast="False" NextText="Next" ResultsLocation="None"
                    PageNumbersSeparator=" " HideOnSinglePage="False" PagingMode="PostBack">
                </asp:CollectionPager>
            </div>
        </div>
    </ContentTemplate>
</asp:UpdatePanel>
<!--Role Popup-->
<div class="dialog DialogListRole" style="display: none" title="Role">
    <asp:UpdatePanel runat="server" ID="UpdatePanelRole">
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="ButtonOK" EventName="click" />
            <asp:AsyncPostBackTrigger ControlID="ButtonCancel" EventName="click" />
        </Triggers>
        <ContentTemplate>
            <div class="widget_contents noPadding">
                <div class="dtTables">
                    <table class="tables noObOline">
                        <asp:Repeater runat="server" ID="RepeaterRole">
                            <ItemTemplate>
                                <tbody>
                                    <tr>
                                        <td>
                                            <input type="checkbox" runat="server" id="checkboxRole" value='<%#Eval("RoleId") %>'
                                                class="simple_form" />
                                            <asp:Literal runat="server" ID="textRoleName" Text='<%#Eval("RoleName") %>'></asp:Literal>
                                        </td>
                                    </tr>
                                </tbody>
                            </ItemTemplate>
                        </asp:Repeater>
                    </table>
                </div>
                <div class="dtBottom">
                    <div class="dtPagination">
                        <asp:Button runat="server" ID="ButtonOK" Text="OK" CssClass="simple_buttons" OnClick="ButtonSaveClick" />
                        <asp:Button runat="server" ID="ButtonCancel" Text="Cancel" CssClass="simple_buttons"
                            OnClientClick="CloseRolePopup()" />
                    </div>
                    <div class="dtInfo">
                        <asp:HiddenField runat="server" ID="HiddenFieldOrganizationId" />
                    </div>
                </div>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</div>
